<form action="" id="catEditor" method="post" target="">
  
  <div class="finder-title" style="display:none">
    <h2 class="head-title span-auto">门店优选管理    </h2>
  </div>

  <table cellspacing="0" cellpadding="0" class="gridlist">
    <col class="Colauto"></col>
    <col class="Coloption_1b"></col>
    <thead>
      <th><{t}>门店信息<{/t}></th>
      <th><{t}>规则状态<{/t}></th>
      <th><{t}>操作<{/t}></th>
    </thead>
    <tbody>
      <{foreach from=$organization item=item key=iLoop name="item"}>
      <tr parentid="<{$item.org_id}>" class="provice-bg">
        <td style="text-align:left; width:320px;">
          <div style="padding-left:<{$item.step*25}>px">
            <{if $item.child_count>0}>
            <span class="imgTree" onclick="clickTree(this);" id="<{$item.org_id}>"> &nbsp;&nbsp; </span>
            <{else}>
            <span class="imgTree tree_open"> &nbsp;&nbsp; </span>
            <{/if}>
            <span style="font-weight:700; color:#000; text-decoration:none;padding-right:15px;" ><{$item.org_name}></span>
          </div>
        </td>
        <td style="text-align:left; width:300px;"><{if $item.org_type == 2}><div id="rule_org_id_<{$item.org_id}>"><{if $item.rule_id}>已启用<{else}><span style="color:#999;">未启用</span><{/if}></div><{/if}></td>
        <td style="width:350px">
            <{if $item.org_type == 2}>
                <a class="i" href='index.php?app=o2o&ctl=admin_autostore&act=addRule&p[0]=<{$item.org_id}>&finder_id=<{$finder_id}>' target="_blank">设置</a>
            <{/if}>
        </td>
      </tr>
      <{/foreach}>
    </tbody>
  </table>
</form>

<script>
function clickTree(el){
    var el=$(el), obj = el.getParent('[parentid]');
    if(!el.hasClass("tree_open")){
        if(!obj.getNext() || !obj.getNext().get('readstatus')){
            var tr=new Element('tr[readstatus=1]').injectAfter(obj).setHTML('<td colspan="5" style="border:0;padding:0;"></td>');
            W.page('index.php?app=o2o&ctl=admin_autostore&act=getChildNode',{update:tr.firstChild,method:'post',data:'orgId='+el.id});
        }
        obj.getNext().show();
        el.addClass("tree_open");
    }else{
        obj.getNext().hide();
        el.removeClass("tree_open");
    }
}
</script>
